{layout name="../common/master"/}
<div id="right">
  <h4>
      <a href="{$_SERVER['HTTP_REFERER']}" class="btn btn-success">返回</a>
  </h4>
    <div class="panel panel-default col-lg-12">
        <div class="panel-heading">
            <h3 class="panel-title">人脸识别结果
                <!--{if condition="isset($data['status']) AND ($data['status'] eq 0)"}<button type="button" id="faceInvalid" phone="{$data['user_phone']}" uid="{$data['id']}" class="btn btn-danger"> 无效 </button>{/if} {if condition="isset($data['status']) AND ($data['status'] eq 1)"}<button type="button" id="sendsms" phone="{$data['user_phone']}" uid="{$data['id']}" class="btn btn-danger"> 发送短信和推送 </button>{/if}-->
            </h3>
        </div>
        <div class="panel-body">
            <table class="table table-hover table-bordered">
                <tbody>
                   <tr>
                       <th>序号</th>
                       <th>userID</th>
                       <th>电话</th>
                       <th>照片</th>
                       <th>识别结果</th>
                       <th>类型</th>
                       <th>状态</th>
                       <th>识别时间</th>
                       <th>addr照片</th>
                   </tr>
                   {if condition="!empty($data)"}
                       <tr>
                           <th>{:isset($data['id'])?$data['id']:''}</th>
                           <th>{:isset($data['user_id'])?$data['user_id']:''}</th>
                           <th>{:isset($data['user_phone'])?$data['user_phone']:''}</th>
                           <th>
                               {foreach name="data['photo']" item="vo"}
                               <img class="userImg" src="data:image/png;base64,{$vo->image}" style="width: 100px" alt="双击放大">
                               {$vo->type}
                               {/foreach}
                           </th>
                           <th>{$data['confidence']}</th>
                           <th>{$data['type']}</th>
                           <th>{$data['status']}</th>
                           <th>{$data['create_time']}</th>
                           <th>
                               <img src="{$person['cardfrontUrl']}" class="userPan" style="width: 100px" alt="">
                           </th>
                       </tr>
                   {/if}
                </tbody>
            </table>
        </div>
    </div>
    </div>

</div>
<script>
    $(".userImg").dblclick(function(){
       var src=$(this).attr('src');
       layer.open({
           area:['600px','700px'],
           content:"<img src="+src+">"
       })
    })
    $(".userPan").dblclick(function(){
       var src=$(this).attr('src');
       layer.open({
           content:"<img src="+src+">",
           area:['1200px','700px'],
           maxmin: true
       })
    })
    $("#faceInvalid").click(function(){
        var uid=$(this).attr('uid');
        var phone=$(this).attr('phone');
        $.post("{:URL('home/User/updateUserface')}",{uid:uid,phone:phone}, function (res) {
            if(res.code == 0){
                layer.alert("success");
                location.reload();
            }else{
                layer.alert(res.data);
                location.reload();
            }
        })
    })

    $("#sendsms").click(function () {
        var phone=$(this).attr('phone');
        $.post("{:URL('home/User/sendSms')}",{phone:phone}, function (res) {
            if(res.code == 0){
                layer.alert("success");
                location.reload();
            }else{
                layer.alert(res.data);
                location.reload();
            }
        })
    })


</script>